home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-11
/
mulread.zip
/
MUL_READ.PRG
< prev
next >
Wrap
Text File
|
1993-01-04
|
5KB
|
150 lines
* Code fragment to do more than one read at a time
* Author: Ron Lane
* BBS : RON'S ROS (817) 540-4183
* this will compile to a simple demo
*
*
CLEA
SET KEY -4 TO F5proc && Proc to call from main read
read1_a = SPACE(10)
read1_b = SPACE(10)
read1_c = SPACE(10)
read1_d = SPACE(20)
read1_e = SPACE(10)
in_var = "" && public var for READVAR()
@ 0,25 SAY "E D I T F5 for Read change"
@ 1,0 TO 24,79
DO get_1 && get our Main gets
DO WHIL .T. && Loop to control our reads
changed = .F. && var to check for sub reads
READ
IF changed && have we done a sub read
SET KEY -4 TO F5proc && reset our proc key
DO get_1 && get our main gets again
SET KEY 99 TO reset_get && looping proc to retun to our current get
KEYBOARD CHR(99) && any key will work
LOOP && do this till we are were we want
ELSE && no sub reads
EXIT && we are done so quit
ENDI
ENDD * --- whil .t.
INKEY(0)
QUIT
**********
PROC get_1
**********
CLEA GETS && this way we can do multi reads
@ 4, 2 CLEA TO 12,78
changed = .T. && so our loop will continue
@ 4, 2 SAY "Read1 A " GET read1_a
@ 6, 2 SAY "Read1 B " GET read1_b
@ 8, 2 SAY "Read1 C " GET read1_c
@ 10, 2 SAY "Read1 D " GET read1_d VALID SUB_READ() && we can do it from
@ 10,35 SAY "Press <CR> on empty get for Valid read" && a Valid Function
@ 12, 2 SAY "Read1 E " GET read1_e
RETU
************
PROC F5proc
************
in_var = READVAR() && update our current read
DO CASE
**
CASE READVAR() = "READ1_A" && check were we are in main read
****
SET KEY -4 TO && kill our proc key
CLEA GETS && kill previous reads
@ 4, 2 CLEA TO 12,78
changed = .T. && we have been here so let main read know
read2_a = SPACE(10) && we could select other workarea
read2_b = SPACE(10) && and make changes
@ 4, 2 SAY "Read2 A " GET read2_a && these could be a proc like get_1
@ 6, 2 SAY "Read2 A " GET read2_b
READ
CASE READVAR() = "READ1_B"
****
SET KEY -4 TO && kill our proc key
CLEA GETS && kill previous reads
@ 4, 2 CLEA TO 12,78
changed = .T. && we have been here so let main read know
read3_a = SPACE(10)
read3_b = SPACE(10)
@ 4, 2 SAY "Read3 A " GET read3_a
@ 6, 2 SAY "Read3 B " GET read3_b
READ
CASE READVAR() = "READ1_C"
****
SET KEY -4 TO && kill our proc key
CLEA GETS && kill previous reads
@ 4, 2 CLEA TO 12,78
changed = .T. && we have been here so let main read know
DO READ1C && Pass control to another proc
OTHE
****
in_var = ""
RETU && do nothing
ENDC * --- Readvar()
RETU && retun to main read
**************
PROC reset_get && our looping proc to get to current get
**************
IF READVAR() = in_var && are we there yet
SET KEY 99 TO && yes so kill our temp key
in_var = "" && clear our current READVAR()
ELSE
KEYBOARD CHR(13) + CHR(99) && no so do it again
ENDI && Chr 13 is <CR>
RETU
***********
PROC read1c
*********** && here we change one of our main gets
read4_a = SPACE(5) && again this could be another workarea
read4_b = SPACE(5)
@ 4, 2 SAY "Read4 A " GET read4_a
@ 6, 2 SAY "Read4 B " GET read4_b
READ
M->&in_var = read4_a + read4_b && update our main var with data from
RETU && this read
*************
FUNC sub_read
*************
in_var = READVAR()
read5_a = SPACE(10) && again this could be another workarea
read5_b = SPACE(10)
DO WHIL EMPTY(M->&in_var) && this could be a test for anything
SET KEY -4 TO && kill our proc key
CLEA GETS && kill previous reads
@ 4, 2 CLEA TO 12,78
@ 4, 2 SAY "Read5 A " GET read5_a
@ 6, 2 SAY "Read5 B " GET read5_b
READ
IF EMPTY(read5_a) .OR. EMPTY(read5_b) && did we update ?
?? CHR(7) && get there attention
@ 10,20 SAY "No empty Gets Please" && tell them whats wrong
INKEY(2)
LOOP
ELSE
M->&in_var = read5_a + read5_b && OK got what we want
DO get_1 && main gets
changed = .F. && in a valid read we don't need to loop
ENDI
SET KEY -4 TO F5proc && reset our proc key
ENDD * --- empty(in_var)
RETU( .T. ) && retun to our Valid function